#include<stdio.h>

int main(void)
{
    char s[3][80];
    int a = 0,b = 0,c = 0,d = 0,e = 0;

    for (int i = 0; i < 3; i++)
    {
        gets(s[i]);
    }
    
    for (int i = 0, j = 0; i < 3 ; i++)
    {
        for (; s[i][j] != '\0'; j++)
        {
            if (s[i][j] >= 'A' && s[i][j] <= 'Z')
            {
                a++;
            }
            else if (s[i][j] >= 'a' && s[i][j] <= 'z')
            {
                b++;
            }
              else if (s[i][j] >= '0' && s[i][j] <= '9')
            {
                c++;
            }
            else if (s[i][j] == ' ')
            {
                d++;
            }
            else
            {
                e++;
            }
         
        }   j = 0;
        
    }  
    printf("%d %d %d %d %d\n",a,b,c,d,e);
}